package com.xiaoma.lock.locksupport;

import java.util.concurrent.locks.LockSupport;

/**
 * @author xiaomacdut
 * @date 2020年2月28日 下午8:58:18
 */
public class LockSupportDemo{
    
    public static void main(String [] args){
        Thread parkThread = new Thread(new ParkThread());
        parkThread.start();
        System.out.println("开始线程唤醒");
        LockSupport.unpark(parkThread);
        System.out.println("结束线程唤醒");
    }
    
    static class ParkThread implements Runnable{
        
        @Override
        public void run(){
            System.out.println("开始线程阻塞");
            LockSupport.park(this);
            System.out.println("结束线程阻塞");
        }
    }
}
